export const transfromNumerToWords = (number) => {
	if (number) {
		const _number = number.toString();
		if (_number.length >= 8) {
			return (_number / 100000000).toFixed(1) + '亿'
		} else {
			return (_number / 10000).toFixed(1) + '万'
		}
	}
}


export const transfromNumberToTime = (number) => {
	if (number) {
		const timeNumber = Number(number);
		const min = timeNumber / 60;
		const sec = timeNumber % 60;
		return `${min>=10?`${Math.floor(min)}`:`0${Math.floor(min)}`}:${sec>=10?`${Math.floor(sec)}`:`0${Math.floor(sec)}`}`
	} else {
		return `00:00`
	}
}

export const transformTimeToNumber = (stringTime) => {
	if (stringTime && typeof stringTime === "string") {
		const min = stringTime.split(":")[0]
		return min * 60 + Number(stringTime.split(":")[1]);
	}
}

export const formateDate = (date) => {
	if (date) {
		const _date = new Date(date);
		const year = _date.getFullYear();
		const mon = _date.getMonth()+1;
		const day = _date.getDate();
		return `${year}-${mon>=10?mon:`0${mon}`}-${day>=10?day:`0${day}`}`
	}
}
